package net.xdclass.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.jsonwebtoken.Claims;
import lombok.Data;

/**
 * @Classname LoginUser
 * @Description TODO
 * @Date 2022/4/15 16:52
 * @Created by sunhao
 */
@Data
public class LoginUser {

  private Long id;

  private String mail;

  @JsonProperty("head_img")
  private String headImg;

  private String name;

  public static  LoginUser transformation(Claims claims){
    LoginUser loginUser = new LoginUser();
    loginUser.setHeadImg(claims.get("head_img",String.class));
    loginUser.setId(Long.valueOf(claims.get("id").toString()));
    loginUser.setMail(claims.get("mail",String.class));
    loginUser.setName(claims.get("name",String.class));
    return loginUser;
  }

}
